Add context compression: compact memory, duplicate prevention, inline context#13
Open
CMander02 wants to merge 1 commit intoziyan-todo-3from
Open
Add context compression: compact memory, duplicate prevention, inline context#13CMander02 wants to merge 1 commit intoziyan-todo-3from
CMander02 wants to merge 1 commit intoziyan-todo-3from
Conversation
…, inline context - Add render_compact_stage_entry with _truncate_section for budget-controlled summaries - append_approved_stage_summary now uses compact entries and prevents duplicate stage headings - build_continuation_prompt inlines user goal, current objective, and recent stage summaries - Continuation prompts now have enough context for session fallback to fresh sessions - 13 new tests covering truncation, dedup, inline context, and size reduction Addresses TODO 4 (V4-1 through V4-4) from vulnerability analysis. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
render_compact_stage_entrywith_truncate_sectionfor budget-controlled memory entriesappend_approved_stage_summaryuses compact entries and prevents duplicate stage headingsbuild_continuation_promptinlines user goal, current objective, and recent stage summariesContext
Example run showed prompt growing from 8KB (Stage 01) to 75KB (Stage 08) — 9.5x inflation.
memory.mdreached 820 lines / 74KB with duplicate content. Continuation prompts had 7x less information than initial prompts.Depends on #12.
Test plan
tests/test_context_compression.py— all passing🤖 Generated with Claude Code